import { defineStore } from 'pinia'

import type { AppState } from '@/store/types'

export const useAppStore = defineStore(
	'app',
	() => {
		const userInfo = ref<AppState['userInfo']>()
		const token = ref<AppState['token']>('')

		const setToken = (value: string) => {
			token.value = value
		}

		return {
			userInfo,
			token,
			setToken,
		}
	},
	{
		persist: true,
	}
)
